package ch2;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class XMLTest {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("/ch2/ch2-beans.xml");
        AccountService accountService = applicationContext.getBean("accountService",AccountService.class);
        System.out.println("before transfer:");
        System.out.println("account 1 balance:"+accountService.getAccount(1).getBalance());
        System.out.println("account 2 balance:"+accountService.getAccount(2).getBalance());
        accountService.transferMoney(1,2,5.0);
        System.out.println("after transfer:");
        System.out.println("account 1 balance:"+accountService.getAccount(1).getBalance());
        System.out.println("account 2 balance:"+accountService.getAccount(2).getBalance());
    }
}
